<?php
include("includes/init.php");
$title="$TenSite - $KhauHieu";
include ("template/Header.php");
?>


<div class="c"></div>
</div>
</div>
</div>
 </div>

<?php
$sql = @mysql_query("select * from duan where TrangThai = '1' order by SapXep asc, IDDuAn desc limit 1");
while ($rows = @mysql_fetch_array($sql))
{
    $url=stripUnicode($rows['TenDuAn']);
    $url=ereg_replace('[[:space:]]+', '-', trim($url));
    if($rows['MoTa']==""){
        $NoiDung=''.substr(strip_tags($rows['NoiDung']),0,600).'';
        $NoiDung=substr($NoiDung, 0, strrpos($NoiDung, ' ')).'...';
    }else{
        $NoiDung=$rows['MoTa'];
    }
   echo '<div class="main home_ver7">
    <div class="main-width">
        <div class="block-content">
            <div class="left-box">
				 </div>
            <div>
				<div class="main-boxcont">
   <div class="cont-maindear">
<div class="mainimg" lang="29100">
<div style="display: none;" class="v6ItemHomeHover hidden" id="itemHomeMoreD29100">
<a class="v6ImageHover" href="'.$link.'Du-An-'.$rows['IDDuAn'].'-'.$url.'.html">
<div class="v6ItemHotHoverText" align="center"></div>
</a>
<div class="v6ItemHotHomeHoverTextT" align="center">
'.$rows['DiaChi'].'
</div>
<div class="v6ItemHomeHoverButton">
<div align="center">
 
<a href="'.$link.'Du-An-'.$rows['IDDuAn'].'-'.$url.'.html" class="mLeft5 v6BtnDetail fixPNG"><img title="Chi tiết" class="fixPNG" src="images/blank.gif" height="35" width="128"></a>
</div>
</div>
</div>
<a href="'.$link.'Du-An-'.$rows['IDDuAn'].'-'.$url.'.html" class="setDealWh">
<div class="v7price_promotion fixPNG mLeft400 mTop10">VIP<span></span></div>
<img src="'.$rows['LoGo'].'" alt="'.$rows['TenDuAn'].' - Giá '.$rows['Gia'].'" height="475" width="475">
</a>
</div>
<div class="right-contdear">
<div class="title-maindear">
<div class="v6TitleShort">
<div class="fl"><a href="'.$link.'Du-An-'.$rows['IDDuAn'].'-'.$url.'.html" title="'.$rows['TenDuAn'].'"><h2>'.$rows['TenDuAn'].'</h2></a> </div>
<div class="v7typeproduct fl m0 mTop5" style="color: #555">';
$sqla = @mysql_query("select TenDanhMuc from danhmuc where IDDanhMuc = '".$rows['DanhMuc']."'");
$rowsa = @mysql_fetch_array($sqla);
echo ' '.$rowsa['TenDanhMuc'].'</div>

<div class="c"></div>

</div>
</div>
<div class="boxPrices">
<div class="boxPrices_view fixPNG">
<div class="v6Price mTop10" align="center">
'.$rows['Gia'].'<span></span>
</div>
 
<div class="v6BuyNow">
<a class=" fixPng" href="Dang-Ky-Tham-Quan-'.$rows['IDDuAn'].'-'.$url.'.html"></a>
</div>
</div>
</div>
<div class="v6BorderBot">
<div class="v6BottomPrice">
<div class="s" style="width:240px;height:200px;overflow:hidden;text-align:justify"><b><br/>
 '.$NoiDung.'
<br/><a style="color:#00A0DC" name="customer29100_5" href="'.$link.'Du-An-'.$rows['IDDuAn'].'-'.$url.'.html">Xem thêm</a><br/></b></div>
</div>
</div>
<div class="v6BorderBot pTop5" style="border-bottom:none">
<div> <i>'.$rows['DiaChi'].'</i></div>
</div>
</div>
<div class="c"></div>
<div class="bottomTopDeal">
<div class="fl">
<div class="v6ItemHomeHoverTextD">
<div class="pageView fl fixPNG">Lượt xem: '.$rows['Xem'].'</div>
 
 
<div class="c"></div>
</div>
</div>
 
<div class="c"></div>
</div>
</div>
</div>
  </div>
            <div class="clear"></div>
        </div>
        <div></div>
    </div>'; 
}
?>
  <script language="javascript">

	jQuery(document).ready(function(){
		jQuery(".mainimg").hover(
			function(){
				var id = jQuery(this).attr('lang');
				jQuery("#itemHomeMoreD"+id).fadeIn(300);
			},
			function(){
				var id = jQuery(this).attr('lang');
				jQuery("#itemHomeMoreD"+id).fadeOut(300);
			}
		);
	});

</script>
    <div class="main-content">
								<div class="main">
<div class="block-content">
<?php
echo show3DuAn1dong("where TrangThai = '1'",6,"HOT");
?>
<div class="c"></div>
</div>
<script language="javascript">
		
		jQuery(document).ready(function(){
			jQuery(".v6ItemHotImg").hover(
			  function () {
				var id = jQuery(this).attr('lang');
				jQuery("#itemHotMoreDetail"+id).fadeIn(300);
			  },
			  function () {
				var id = jQuery(this).attr('lang');
				jQuery("#itemHotMoreDetail"+id).fadeOut(300);
			  }
		   );
		});
		
	</script>
</div>				

<div class="mTop20 pTop15">


<?php
$stt=0;
$sql = @mysql_query("select * from danhmuc where TrangThai = '1' order by SapXep asc, IDDanhMuc asc");
while ($rows = @mysql_fetch_array($sql))
{  
   $SoDuAn=mysql_num_rows(@mysql_query("select * from duan where TrangThai = '1' and DanhMuc = '".$rows['IDDanhMuc']."'"));
   if($SoDuAn==0){
    $NumberDuAn='';
   }else{
    $NumberDuAn="(<b>$SoDuAn</b>)";
   }
   
    $url=stripUnicode($rows['TenDanhMuc']);
    $url=ereg_replace('[[:space:]]+', '-', trim($url));
    if($SoDuAn>0){
        $stt=$stt+1;
        if($stt%2==0){
        $weekly='';
         
    }else{
        $weekly='weekly2';
    }
    $sql1 = @mysql_query("select * from duan where TrangThai = '1' and DanhMuc = '".$rows['IDDanhMuc']."' order by SapXep asc, IDDuAn desc limit 8");
    $sotin=mysql_num_rows($sql1);
    $lenght="'$sotin'";
   echo ' 
<div class="weekly '.$weekly.'" align="center">
<div class="homecate_c">
<div id="scrollbox'.$sotin.'" style="z-index: 10">
<div class="v6TitleCate" id="dockCat'.$sotin.'">
<h2 class="fl">'.$rows['TenDanhMuc'].' '.$NumberDuAn.'</h2>
<div class="fl link">
<a href="'.$link.'Danh-Muc-'.$rows['IDDanhMuc'].'-'.$url.'.html" class="fl v7linkcate">Xem thêm</a>
</div>
<div class="c"></div>
</div>
<div class="c"></div>
</div>
<div style="left: -45px; display: none;" class="v6PreCatePage hidden" id="v6PreCatePage'.$sotin.'">
<a class="link_block" href="javascript:void(0)"></a>
</div>';
if($sotin>4){
echo '<div style="right: -45px; display: block;" class="v6NextCatePage" id="v6NextCatePage'.$sotin.'">
<a class="link_block" href="javascript:void(0)"></a>
</div>';
}

echo '<div class="v6ContentCate pTop5">';
if($sotin>8){
echo '<a style="width: 251px; right: -23px; display: none;" class="v7Bgnew hidden" href="'.$link.'Danh-Muc-'.$rows['IDDanhMuc'].'-'.$url.'.html" id="v7Bgnew'.$sotin.'">
<span class="v7inview">Xem tiếp</span><br>
<span class="v7productnum">Còn '.($sotin-8).' dự án</span>
</a>';
}
echo '
<div class="v6CatePage"><div style="position: relative; display: block;" id="jCarouselNew'.$sotin.'" class="jCarouselNew jcarousel-container jcarousel-container-horizontal">
<div style="position: absolute;" class="jcarousel-clip jcarousel-clip-horizontal"><ul style="overflow: hidden; position: absolute; top: 0px; margin: 0px; padding: 0px; left: 0px; width: 2378px;" class="listHomeCate jcarousel-list jcarousel-list-horizontal">'; 


if(mysql_num_rows($sql1)==0){
    echo '<div align="center" style="text-align: center;color: red;font-weight: bold;"><br/><br/><br/>Chưa có dự án nào trong mục này !<br/><br/><br/></div>		';
}
 
while ($rows1 = @mysql_fetch_array($sql1))
{ 
    if($rows1['MoTa']==""){
        $NoiDung=''.substr(strip_tags($rows1['NoiDung']),0,300).'';
        $NoiDung=substr($NoiDung, 0, strrpos($NoiDung, ' ')).'...';
    }else{
        $NoiDung=$rows1['MoTa'];
    }
    $url=stripUnicode($rows1['TenDuAn']);
    $url=ereg_replace('[[:space:]]+', '-', trim($url));
    echo  '<li jcarouselindex="'.$rows1['IDDuAn'].'" class="v6Item jcarousel-item jcarousel-item-horizontal jcarousel-item-'.$rows1['IDDuAn'].' jcarousel-item-'.$rows1['IDDuAn'].'-horizontal" style="float: left; list-style: none outside none;">
<div class="v6ItemCon">
<div class="v6ItemContent">
<div class="v6ItemImg" lang="'.$rows1['IDDuAn'].'">
<div style="display: none;" class="v6ItemHover hidden" id="itemMoreDetail'.$rows1['IDDuAn'].'">
<a class="v6ImageHover" href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html">
<div class="v6ItemHoverText" align="center"></div>
<div class="v6ItemHoverTextT">
'.$rows1['DiaChi'].'
</div>
</a>
 
</div>
<a href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html">
<div class="v7price_promotionsmall">NEW<span></span></div>
<img id="itemImages'.$rows1['IDDuAn'].'" src="'.$rows1['LoGo'].'" height="217" width="217">
</a>
 
</div>
<div class="v6ItemTitle" align="left">
<div><a href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html" title="Xem chi tiết dự án">'.$rows1['TenDuAn'].'</a> </div>
<div style="height: 70px;padding: 10px;overflow:hidden;text-align:justify">'.$NoiDung.'</div>
</div>
<div class="v6ItemPrice">
<div class="fl pTop5 v7price">
<div class="v7PromotionSmall">'.$rows1['Gia'].'<span></span></div>
 
</div>
 
<a href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html" class="v7viewSmall fr fixPNG"><img src="images/blank.gif" height="30" width="39"></a>
 <div class="c"></div></div>
</div>
</div>
</li>';
    
}

 

echo '</ul></div>
<div class="c"></div>
</div></div>
</div>
</div>
<div class="c"></div>
</div>
<script language="javascript">shop.jCarouse.data[shop.jCarouse.data.length] = '.$lenght.';</script>';
}
}
?>


</div>
<script type="text/javascript">shop.fixWidthHomeCat();</script></div>
</div>
<?php
include ("template/Footer.php");
?> 
